package main

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

type Article struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

func main() {
	r := gin.Default()

	r.LoadHTMLGlob("../templates/**/*")

	// r.GET("/", func(c *gin.Context) {
	// 	c.HTML(http.StatusOK, "goods.html", gin.H{
	// 		"title": "111",
	// 	})
	// })
	r.GET("/json", func(c *gin.Context) {
		article := &Article{Title: "11111s", Content: "xxx"}
		c.HTML(http.StatusOK, "client/news.html", gin.H{
			"title":   article.Title,
			"article": article,
		})
	})

	r.Run(":9000")
}
